package cn.wen233.core.wrapper.query;

import cn.wen233.basic.exceptions.BaseException;
import cn.wen233.basic.model.Service;
import cn.wen233.core.mapper.ServiceMapper;
import cn.wen233.core.utils.IocUtils;

import java.util.Optional;

/**
 * 包装mapper方法
 *
 * @author wenei
 * @date 2021-10-24 15:43
 */
public class ServiceQuery {

    private static final ServiceMapper serviceMapper = IocUtils.getBean(ServiceMapper.class);

    public static Service getNamespaceService(String namespaceId, String serviceId) {
        return Optional.ofNullable(serviceMapper.selectServiceByNamespaceIdAndServiceId(namespaceId, serviceId))
                .orElse(null);
    }
}
